home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj1086.arc
/
DOTTIME.MOD
< prev
next >
Wrap
Text File
|
1986-07-22
|
3KB
|
97 lines
IMPLEMENTATION MODULE DotTime;
IMPORT Terminal;
FROM SYSTEM IMPORT AX, BX, CX, DX, ES, SWI, GETREG, SETREG, CODE,
ADR;
FROM LowEGA IMPORT SetModeBios, SetUpHiRes, SetUpAlpha, DrawPoint,
SetBiosCursorPoint, BiosCRTParams;
FROM TimeDate IMPORT GetTime, Time;
FROM RealConversions IMPORT RealToString;
FROM PointLib IMPORT Point, MakePoint;
FROM Pauses IMPORT Pause;
CONST
HiRes = 010H; (* Color Hi Res Mode *)
Alpha = 003H; (* Color Alpha Mode *)
VIDEO = 010H; (* Video Interrupt *)
Page0 = 0H;
DisplayPageAddr = 0A000H;
PROCEDURE DotTimingTest;
(* This routine paints 65000 pixels on the CRT in three ways.
The time for each method is recorded for the user to see *)
VAR t1 : REAL;
l1 : ARRAY [0..50] OF CHAR;
ok : BOOLEAN;
j, rowbyte : CARDINAL;
bitmasks : ARRAY [0..7] OF CARDINAL;
Times : ARRAY [0..5] OF Time;
byteoff,bitmask : CARDINAL;
p : Point;
PROCEDURE MakeTime(Stop, Start : CARDINAL);
VAR mins : CARDINAL;
BEGIN
mins := Times[Stop].minute - Times[Start].minute;
t1 := FLOAT(mins) * 60000. + FLOAT(Times[Stop].millisec) -
FLOAT(Times[Start].millisec);
t1 := t1 / 1000.;
RealToString(t1, 3, 7, l1, ok);
Terminal.WriteString(l1); Terminal.WriteLn;
END MakeTime;
BEGIN
bitmasks[7] := 1; bitmasks[6] := 2;
bitmasks[5] := 4; bitmasks[4] := 8;
bitmasks[3] := 16; bitmasks[2] := 32;
bitmasks[1] := 64; bitmasks[0] := 128;
Pause('Dot Timing Test');
SetModeBios(HiRes); SetUpHiRes;
(* The first test -- direct subroutine call *)
MakePoint(p, 25, 25); GetTime(Times[0]);
FOR j := 0 TO 65000 DO
DrawPoint(p, 4);
END;
GetTime(Times[1]);
(* Test #2 -- Bios calls *)
MakePoint(p, 50, 50); GetTime(Times[2]);
FOR j := 0 TO 65000 DO
SETREG(BX, 0); SETREG(AX, 0C02h);
SETREG(CX, p.x); SETREG(DX, p.y);
SWI(VIDEO);
END;
GetTime(Times[3]);
(* Test #3 -- direct inline assembler code *)
MakePoint(p, 75, 75); GetTime(Times[4]);
FOR j := 0 TO 65000 DO
rowbyte := p.x DIV 8; GETREG(DX, bitmask);
bitmask := bitmasks[bitmask];
byteoff := CARDINAL(p.y) * BiosCRTParams.CRTCols + rowbyte;
SETREG(ES, DisplayPageAddr); SETREG(BX, byteoff);
SETREG(CX, 1); SETREG(AX, bitmask);
CODE(88h, 0c4h, 0b0h, 08h, 0bah, 0ceh, 03h, 0efh, 0b8h, 02h,
0ffh, 0b2h, 0c4h, 0efh, 26h, 08ah, 2fh, 26h, 0c6h, 07h,
00h, 88h, 0cch, 0efh, 026h, 0c6h, 07h, 0ffh, 0b4h, 0ffh,
0efh, 0b2h, 0ceh, 0b8h, 03h, 00h, 0efh, 0b8h, 08h, 0ffh,
0efh);
END;
GetTime(Times[5]);
(* Now to report the results on the screen *)
SetModeBios(Alpha);
MakePoint(p, 0, 6); SetBiosCursorPoint(Page0, p);
Terminal.WriteString('Subroutine time = ');
MakeTime(1, 0);
Terminal.WriteString('EGA BIOS time = ');
MakeTime(3, 2);
Terminal.WriteString('Direct In Line Code Time = ');
MakeTime(5, 4);
SetUpAlpha;
Pause('End Dot Timing Test');
END DotTimingTest;
END DotTime.